package network;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * Creared with IntelliJ IDEA.
 * Description:
 * User:yxd
 * Date:2022-04-12
 * Time:20:57
 */
public class TCPDictEchoServer extends TCPThreadEchoServer{
    private Map<String,String> map = new HashMap<>();
    public TCPDictEchoServer(int port) throws IOException {
        super(port);
        map.put("dog","二狗");
        map.put("pig","小猪猪");
        map.put("cat","猫咪");
    }
    @Override
    public String process(String request) {
        return map.getOrDefault(request,"没有此单词!");
    }

    public static void main(String[] args) throws IOException {
        TCPDictEchoServer server = new TCPDictEchoServer(9090);
        server.start();
    }
}
